﻿'         This file is Copyright © 2008-2012 Billy O'Neal and Aommaster
'                            All rights reserved.
'
' This file is released under the 2-Clause BSD license, included in LICENSE.TXT
'                           and on the MHWT website
Friend Class Stats

    Private Sub Stats_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim totallogs As Integer = 0
        Dim completelogs As Integer = 0
        Dim stalelogs As Integer = 0
        Dim openlogs As Integer = 0

        For Each log As Topic In GlobalData.openTopics
            If log.Status = "Completed" Then
                totallogs += 1
                completelogs += 1
            ElseIf log.Status = "Stale" Then
                totallogs += 1
                stalelogs += 1
            Else
                openlogs += 1
            End If
        Next
        For Each log As Topic In GlobalData.archive
            If log.Status = "Completed" Then
                totallogs += 1
                completelogs += 1
            ElseIf log.Status = "Stale" Then
                totallogs += 1
                stalelogs += 1
            Else
                openlogs += 1
            End If
        Next

        compno.Text = completelogs.ToString
        staleno.Text = stalelogs.ToString
        totalno.Text = totallogs.ToString
        openno.Text = openlogs.ToString
        If totallogs <> 0 Then
            compper.Text = CInt((completelogs * 100 / totallogs)).ToString + "%"
            staleper.Text = CInt((stalelogs * 100 / totallogs)).ToString + "%"
        Else
            compper.Text = "N/A"
            staleper.Text = "N/A"
        End If
    End Sub
End Class